<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use \Illuminate\Routing\Router;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

use App\Http\Controllers\Api\SmallApp\User\RegisterController;
use App\Http\Controllers\Api\SmallApp\User\LoginController;
use App\Http\Controllers\Api\SmallApp\User\UserController;
use App\Http\Controllers\Api\SmallApp\Order\RepairFactoryController;
use App\Http\Controllers\Api\SmallApp\Order\ApplyController;
use App\Http\Controllers\Api\SmallApp\Order\MyOrderController;
use App\Http\Controllers\Api\SmallApp\Index\IndexController;

Route::group(['prefix'=>''],function (Router $router){

    $router->post('/register',[RegisterController::class,'register']);
    $router->get('/getVerifyCode',[RegisterController::class,'getVerifyCode']);
    $router->post('/loginWithVerifyCode',[LoginController::class,'loginWithVerifyCode']);
    $router->post('/loginWithPassword',[LoginController::class,'loginWithPassword']);

});


Route::group(['prefix'=>'index'],function (Router $router){
    $router->get('/advert',[IndexController::class,'advert']);
    $router->get('/service',[IndexController::class,'service']);
    $router->get('/userNotify',[IndexController::class,'userNotify']);
    $router->get('/updatePublicOpenId',[IndexController::class,'updatePublicOpenId']);
    $router->get('/getWxCode',[IndexController::class,'getWxCode']);
    $router->get('/wxSmallMessage',[IndexController::class,'wxSmallMessage']);
    $router->post('/finishWx',[IndexController::class,'finishWx']);
});


Route::group(['prefix'=>'user','middlware'=>'checkapi'],function (Router $router){
    $router->get('/getUserInfo',[UserController::class,'getUserInfo']);
    $router->get('/changeCallPhone',[UserController::class,'changeCallPhone']);
    $router->post('/changePassword',[UserController::class,'changePassword']);
});

Route::group(['prefix'=>'repair','middlware'=>'checkapi'],function (Router $router){
    $router->post('/addComment',[RepairFactoryController::class,'addComment']);
    $router->get('/detail',[RepairFactoryController::class,'detail']);
    $router->get('/zan',[RepairFactoryController::class,'zan']);
});

Route::group(['prefix'=>'apply','middlware'=>'checkapi'],function (Router $router){
    $router->get('/isAllowApply',[ApplyController::class,'isAllowApply']);
    $router->post('/uploadDingSun',[ApplyController::class,'uploadDingSun']);
    $router->post('/apply',[ApplyController::class,'apply']);

    $router->get('/index',[ApplyController::class,'index']);
    $router->get('/detail',[ApplyController::class,'detail']);
    $router->post('/selfRepair',[ApplyController::class,'selfRepair']);
    $router->get('/sendInvoiceAddress',[ApplyController::class,'sendInvoiceAddress']);
    $router->get('/appointRepairFactory',[ApplyController::class,'appointRepairFactory']);
    $router->get('/searchRepairFactoryLst',[ApplyController::class,'searchRepairFactoryLst']);
    $router->get('/cancel',[ApplyController::class,'cancel']);
});

Route::group(['prefix'=>'myOrder','middlware'=>'checkapi'],function (Router $router){
    $router->get('/appointRepairFactoryIndex',[MyOrderController::class,'appointRepairFactoryIndex']);
    $router->get('/selfRepairIndex',[MyOrderController::class,'selfRepairIndex']);
    $router->get('/detail',[MyOrderController::class,'detail']);
    $router->get('/cancel',[MyOrderController::class,'cancel']);
    $router->get('/receiveOrder',[MyOrderController::class,'receiveOrder']);
    $router->get('/startRepair',[MyOrderController::class,'startRepair']);
    $router->get('/repaired',[MyOrderController::class,'repaired']);
});
